import gtk
import conf

class Main:
	
	def __init__(self, popupMenuName, popupMenuEvents):
		self.__tray = gtk.StatusIcon()
		self.__tray.set_tooltip("Absynth FTP")
		self.__tray.set_from_stock("gtk-network")
		#self.__tray.set_from_icon_name(conf.DATA_DIR + "/img/logo_minimal.png")
		
		self.__popupMenuName = popupMenuName
		self.__popupMenuEvents = popupMenuEvents
		self.__tray.connect("popup_menu", self.__loadPopupMenu)
		
		
	def __loadPopupMenu(self, status_icon, button, activate_time):
		#popmenu =  gtk.glade.XML(conf.GLADE_MAIN_WINDOW, self.__popupMenuName)
		#popmenu.signal_autoconnect(self.__events)

		#if self.connection.get_status() == False:
			#popmenu.get_widget('disconnect').set_sensitive(False)
		#popmenu.get_widget(self.__popupMenuName).popup(None, None, None, button, activate_time)
		#print dir(self.__popup)
		gladeInstance = gtk.glade.XML(conf.GLADE_MAIN_WINDOW, self.__popupMenuName)
		gladeInstance.signal_autoconnect(self.__popupMenuEvents)
		gladeInstance.get_widget(self.__popupMenuName).popup(None, None, None, button, activate_time)
		
#print conf.DATA_DIR + "/img/logo_minimal.png"